﻿namespace MyTRCP.Common.Codecs.Sbc
{
    public class SbcConfig
        {
            public FrequencyEnum Frequency { get; set; }
            public byte Bitpool { get; set; }
            public BlocksEnum BlockNum { get; set; }
            public SubbandsEnum SubBandNum { get; set; }
            public ChannelModeEnum Mode { get; set; }
            public AllocationMethodEnum AllocationMethod { get; set; }
            public DataEndianessEnum DataEndianess { get; set; }
            public static SbcConfig CreateSbcConfig(FrequencyEnum freq, byte bitpool, BlocksEnum blocks, SubbandsEnum subbands, ChannelModeEnum mode, bool isMethodSNR, bool isBigEndian)
            {
                return new SbcConfig() { Frequency = freq, Bitpool = bitpool, BlockNum = blocks, SubBandNum = subbands, Mode = mode, AllocationMethod = isMethodSNR ? AllocationMethodEnum.SBC_AM_SNR : AllocationMethodEnum.SBC_AM_LOUDNESS, DataEndianess = isBigEndian ? DataEndianessEnum.SBC_BE : DataEndianessEnum.SBC_LE };
            }
            public static SbcConfig CreateMyVoiceSbcConfigBE()
            {
                return new SbcConfig() { Frequency = FrequencyEnum.SBC_FREQ_32000, AllocationMethod = AllocationMethodEnum.SBC_AM_LOUDNESS, Bitpool = 18, BlockNum = BlocksEnum.SBC_BLK_16, DataEndianess = DataEndianessEnum.SBC_BE, SubBandNum = SubbandsEnum.SBC_SB_8, Mode = ChannelModeEnum.SBC_MODE_MONO };
            }
            public static SbcConfig CreateMyVoiceSbcConfigLE()
            {
                return new SbcConfig() { Frequency = FrequencyEnum.SBC_FREQ_32000, AllocationMethod = AllocationMethodEnum.SBC_AM_LOUDNESS, Bitpool = 18, BlockNum = BlocksEnum.SBC_BLK_16, DataEndianess = DataEndianessEnum.SBC_LE, SubBandNum = SubbandsEnum.SBC_SB_8, Mode = ChannelModeEnum.SBC_MODE_MONO };
            }
        }
}
